package com.yfp.client.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yfp.client.domain.DeviceCurrentComboStock;
import com.yfp.client.domain.OrderCombo;
import com.yfp.client.domain.OrderDetail;
import com.yfp.client.domain.dto.ShoppingCartsDto;

import java.util.List;

/**
 * @author admin
 * @description 针对表【device_current_combo_stock】的数据库操作Service
 * @createDate 2024-06-05 13:47:14
 */
public interface DeviceCurrentComboStockService extends IService<DeviceCurrentComboStock> {

    /**
     * 检测库存
     *
     * @param shoppingCartList
     * @param machineId
     * @return 超出库存数量的套餐
     */
    Boolean checkStockAvailability(List<ShoppingCartsDto> shoppingCartList, String machineId);

    /**
     * 减少库存
     *
     * @param shoppingCartList
     * @param machineId
     */
    void decreaseStockQuantity(List<ShoppingCartsDto> shoppingCartList, String machineId);

    /**
     * 缺少的套餐数量
     *
     * @param shoppingCartList
     * @param machineId
     * @return
     */
    List<ShoppingCartsDto> lackList(List<ShoppingCartsDto> shoppingCartList, String machineId);

    /**
     * 恢复库存
     *
     * @param orderCombo
     * @param orderDetails
     */
    void recoverStockQuantity(OrderCombo orderCombo, List<OrderDetail> orderDetails);

    /**
     * 根据设备id查询套餐库存
     *
     * @param machineId
     * @return
     */
    List<DeviceCurrentComboStock> getByMachineId(Long machineId);
}
